package com.example.util;

import lombok.Data;

/**
 * @author 贾明祯
 * @ClassName Result
 * @Date 2020/8/13 14:10
 */
@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;

    private Result(int code, String msg){
        this.code=code;
        this.msg=msg;
    }

    private Result(int code, String msg,T data){
        this.code=code;
        this.msg=msg;
        this.data=data;
    }
    /**
     * @Author: 贾明祯
     * @Date: 2020/8/13 14:22
     * @introduce: 处理成功
     */
    public static Result success(int code, String msg, Object data){
        return new Result(code,msg,data);
    }
    public static Result success(int code, String msg){
        return new Result(code,msg);
    }
    /**
     * @Author: 贾明祯
     * @Date: 2020/8/13 14:23
     * @introduce: 处理失败
     */
    public static Result error(int code, String msg){
        return new Result(code,msg);
    }
}
